package atm;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 查询界面
 */
public class SearchPanel extends JPanel implements ActionListener {
    private ATM05 atm05;
    private LoginPanel loginPanel;
    private JLabel searchLabel = new JLabel("您的余额为:");
    private JTextField searchTextField = new JTextField();
    private JButton offBtn = new JButton(new ImageIcon("images/buttonOff.jpg"));
    private Font font = new Font("宋体",Font.BOLD,25);

    public SearchPanel(ATM05 atm05){
        this.atm05 = atm05;
        this.setLayout(null);
        this.setOpaque(false);

        searchLabel.setBounds(300,200,200,50);
        searchLabel.setFont(font);
        searchTextField.setBounds(300,260,300,50);
        searchTextField.setFont(font);
        offBtn.setBounds(400,340,100,50);
        offBtn.addActionListener(this);

        this.add(searchLabel);
        this.add(searchTextField);
        this.add(offBtn);

    }

    public void showMoney(){
        searchTextField.setText(atm05.getLoginUser().getMoney() + "");
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        searchTextField.setText("");
        atm05.showPanel("menu");
    }
}
